package main;


	

	import java.awt.BasicStroke;
	import java.awt.Color;
	import java.awt.Graphics;
	import java.awt.Graphics2D;
	import java.awt.RenderingHints;



	//棋子类
	public class QiZi {
		private int x=0;//x坐标
		private int y=0;//y坐标
		private int h=36;
		private int type=1;//1:白棋 2：黑棋
		private boolean last = false;//是否是最后一步棋子
		
		
		

		

		public int getX() {
			return x;
		}

		public void setX(int x) {
			this.x = x;
		}

		public int getY() {
			return y;
		}

		public void setY(int y) {
			this.y = y;
		}

		public int getH() {
			return h;
		}

		public void setH(int h) {
			this.h = h;
		}

		public int getType() {
			return type;
		}

		public void setType(int type) {
			this.type = type;
		}

		public boolean isLast() {
			return last;
		}

		public void setLast(boolean last) {
			this.last = last;
		}

		//构造方法
		public QiZi(int x, int y, int type) {
			super();
			
			this.x = x;
			this.y = y;
			
			this.type = type;
		}
		
		public void draw(Graphics g) {
			//定义一个Graphics2D
	        Graphics2D gg = (Graphics2D) g;
	        gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	        gg.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
			
			if(type==1) {
				 gg.setColor(Color.WHITE);
	             gg.fillOval(x-h/2, y-h/2, 32, 32);
			}else {
				 gg.setColor(Color.BLACK);
	             gg.fillOval(x-h/2, y-h/2, 32, 32);
			}
			
			if(last) {//如果是最后一步
				gg.setStroke(new BasicStroke(1.6f));//粗
				gg.setColor(Color.red);
				gg.drawRect(x-3, y-3, 6, 6);
			}
		}}
		/*private void ovalPaint(Graphics2D gg) {
			// TODO Auto-generated method stub
			 
			    final int NUM = 15;             //棋盘线的条数
			    
			    final int OFFSET_X = 26;  //棋盘左上角相对于panel左上角的偏移量(棋盘的起始位置)
			    final int OFFSET_Y = 26;

			    final int SP = 40; //棋盘每条线的间隔

			      

			    final int OVAL_SIZE = 32;   //棋子的大小

			    int[][] table = new int[NUM][NUM];  //二维数字记录棋盘上每个位置上的棋子 （0无棋子  1白子  2黑子）

			    
			    
			  
}*/
